package ipt.capitulo11;

public class PrimerHilo implements Runnable {
	
	final short limiteS = 1000;
	private short limiteI = 0;

	
	public void run() {
		while (limiteI++ < limiteS) {
			System.out.print("El hilo actual es: ");
			System.out.println(Thread.currentThread().toString());
			try {
				Thread.currentThread().sleep(100);
			} catch (InterruptedException e) {
				System.out.println("Hilo hijo interrumpido");
			}
			System.exit(1);
		}
	}
	
	public static void main(String argv[]) {
		PrimerHilo destino = new PrimerHilo();
		Thread nuevoHilo = new Thread(destino, "Nuevo hilo");
		nuevoHilo.start();
		System.out.println("El hilo principal ha terminado");
	}
	
}
